<?php

return [
    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
    'modules' => require(__DIR__ . '/modules.php'),
    'components' => [
        'i18n' => [
            'translations' => [
                'custom' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@common/messages',
                    'sourceLanguage' => 'zh-CN',
                ],
            ],
        ],
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=localhost;dbname=anhaoiot',
            'username' => 'root',
            'password' => 'root',
            'charset' => 'utf8',
            'enableSchemaCache' => false,
            'tablePrefix' => 'anhao'
        ],
        'httpclient' => [
            'class' => 'yii\httpclient\Client',
        ],

        'redis' => [
            'class' => 'yii\redis\Connection',
            'hostname' => 'localhost',
            'port' => 6379,
            'database' => 0,
//            'unixSocket' => '/tmp/redis.sock'
        ],
        'cache' => [
            'class' => 'yii\redis\Cache'
        ],
        'usercache' => [
            'class' => 'yii\redis\Cache'
        ],
        'session' => [
            'class' => 'yii\redis\Session'
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
                [
                    'class' => 'yii\log\FileTarget',
                    'logFile' => '@runtime/logs/http-request.log',
                    'categories' => ['yii\httpclient\*'],
                ],
            ],
        ],
        'rpc' => [
            'class' => 'yii\swoole\rpc\NavClient',
        ],
        'export' => [
            'class' => 'yii\swoole\files\ExportFile',
            'filePath' => '@upload/print/advice/',
            'suffix' => '.xlsx'
        ]
    ],
    'language' => 'zh-CN',
    'sourceLanguage' => 'en-US'
];
